<?php 
get_header();
?>
	<div id="container">
        <div id="spnav">
        <?php 
        $args=array(
          'sort_column' => 'menu_order',
          'post_type' => 'page',
          'parent' => 60,
          'hierarchical' => 0
        );
        $pages = get_pages($args);  
        /*accordion_index记录每次打开时accordion应打开的部分*/
        $accordion_index=-1;  
        $accordion_flg=1;
        if ($pages) {
          foreach ($pages as $each) {
            if($accordion_flg==1)
                $accordion_index=$accordion_index+1;
            if($post->ID == $each->ID)
                $accordion_flg=0;
        ?>
            <?php echo '<h3 class="sppage" id="post-'.$each->ID.'">'.$each->post_title.'</h3>' ?>
            <div>
                <ul>
                    <?php
                    $subargs=array(
                      'child_of' => $each->ID,
                      'sort_column' => 'menu_order',
                      'post_type' => 'page'
                    );
                    $subpages = get_pages($subargs);
                    foreach($subpages as $subeach)
                    {
                        if($post->ID == $subeach->ID)
                            $accordion_flg=0;
                        echo '<li ><a id="post-'.$subeach->ID.'" href="'.$subeach->guid.'">'.$subeach->post_title.'</a></li>';
                    }
                    ?>
                </ul>                
            </div>
        <?php
          }
        if($accordion_flg==1)
                $accordion_index=0;
        }
        ?>
        </div>
        <div id="spcontent">
            <div class="sptag">
                
                <?php 
                    $meta_values = get_post_meta($post->ID, "sptag",true);
                    $meta_array = preg_split("/[\s,]+/", $meta_values);                    
                    print_r($keywords);
                ?>
                <a href="#" class="<?php if(array_search("std",$meta_array)===FALSE) echo 'spunselected'; else  echo 'spselected'; ?>">标准</a>
                <a href="#" class="<?php if(array_search("mysql",$meta_array)===FALSE) echo 'spunselected'; else  echo 'spselected'; ?>">MySQL</a>
                <a href="#" class="<?php if(array_search("oracle",$meta_array)===FALSE) echo 'spunselected'; else  echo 'spselected'; ?>">Oracle</a>
                <a href="#" class="<?php if(array_search("sqlserver",$meta_array)===FALSE) echo 'spunselected'; else  echo 'spselected'; ?>">SQLServer</a>
                <a href="#" class="<?php if(array_search("db2",$meta_array)===FALSE) echo 'spunselected'; else  echo 'spselected'; ?>">DB2</a>
            </div>
            <div class="pagecontent">
                <?php while ( have_posts() ) : the_post(); ?>
					<?php get_template_part( 'content', 'page' ); ?>
					<?php comments_template( '', true ); ?>
				<?php endwhile; // end of the loop. ?>
            </div>
        </div>
    </div><!-- #container -->
    
<?php get_footer(); ?>